From: Marco Trevisan (TreviƱo) Date: Sat, 31 Aug 2019 21:09:04 +0000 (+0200) Subject: system: Track buttonGroup visibility using a group of actors X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~811^2^2~158 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=a497afe695a9966c66efb40d1da4f255df632dfa;p=gnome-shell.git system: Track buttonGroup visibility using a group of actors Cleanup the visibility check on actions by using an array of actors to track, so that we don't repeat the same variables multiple times. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/700 --- diff --git a/js/ui/status/system.js b/js/ui/status/system.js index 2b2d99184..f18a8e270 100644 --- a/js/ui/status/system.js +++ b/js/ui/status/system.js @@ -137,15 +137,6 @@ var Indicator = class extends PanelMenu.SystemIndicator { this._sessionUpdated(); } - _updateActionsVisibility() { - let visible = (this._settingsAction.visible || - this._orientationLockAction.visible || - this._lockScreenAction.visible || - this._altSwitcher.actor.visible); - - this.buttonGroup.visible = visible; - } - _sessionUpdated() { this._settingsAction.visible = Main.sessionMode.allowSettings; } @@ -302,15 +293,18 @@ var Indicator = class extends PanelMenu.SystemIndicator { this.menu.addMenuItem(item); - - this._settingsAction.connect('notify::visible', - () => this._updateActionsVisibility()); - this._orientationLockAction.connect('notify::visible', - () => this._updateActionsVisibility()); - this._lockScreenAction.connect('notify::visible', - () => this._updateActionsVisibility()); - this._altSwitcher.actor.connect('notify::visible', - () => this._updateActionsVisibility()); + let visibilityGroup = [ + this._settingsAction, + this._orientationLockAction, + this._lockScreenAction, + this._altSwitcher.actor, + ]; + + for (let actor of visibilityGroup) { + actor.connect('notify::visible', () => { + this.buttonGroup.visible = visibilityGroup.some(a => a.visible); + }); + } } _onSettingsClicked() {